package com.zxx.pattern.proxyPattern.proxyDynamic.dynamic1;

import java.lang.reflect.Proxy;

/**
 * 利用JDK
 * @author zxx on 2021/5/11
 */
public class TestDynamic1 {
    public static void main(String[] args) {
        Car car = new Car();
        Class<?> carClass = car.getClass();

        TimeInvocationHandler handler = new TimeInvocationHandler(car);

        Vehicle vehicle = (Vehicle) Proxy.newProxyInstance(carClass.getClassLoader(), carClass.getInterfaces(), handler);

        vehicle.move();


    }
}
